WavySlider

fun WavySlider(value: Float, onValueChange: (Float) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, valueRange: ClosedFloatingPointRange<Float> = 0f..1f, onValueChangeFinished: () -> Unit? = null, colors: SliderColors = SliderDefaults.colors(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, waveLength: Dp = SliderDefaults.WaveLength, waveHeight: Dp = SliderDefaults.WaveHeight, waveVelocity: WaveVelocity = SliderDefaults.WaveVelocity, waveThickness: Dp = SliderDefaults.WaveThickness, trackThickness: Dp = SliderDefaults.TrackThickness, incremental: Boolean = SliderDefaults.Incremental, animationSpecs: WaveAnimationSpecs = SliderDefaults.WaveAnimationSpecs)(source)

A wavy slider much like the Material Design 3 Slider.

Setting waveHeight or waveLength to 0.dp results in a regular Slider.

Note that range sliders do not make sense for the WavySlider. So, there is no RangeWavySlider counterpart.

It uses SliderDefaults.Thumb and SliderDefaults.Track as the thumb and track.

Parameters

value

current value of the WavySlider. Will be coerced to valueRange.

onValueChange

callback in which value should be updated.

modifier

the Modifier to be applied to this WavySlider.

enabled

controls the enabled state of this WavySlider. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

valueRange

range of values that this WavySlider can take. The passed value will be coerced to this range.

onValueChangeFinished

called when value change has ended. This should not be used to update the WavySlider value (use onValueChange instead), but rather to know when the user has completed selecting a new value by ending a drag or a click.

colors

SliderColors that will be used to resolve the colors used for this WavySlider in different states. See SliderDefaults.colors.

interactionSource

the MutableInteractionSource representing the stream of Interactions for this WavySlider. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this slider in different states.

waveLength

the distance over which the wave's shape repeats.

waveHeight

the total height of the wave (from crest to trough i.e. amplitude * 2). The final rendered height of the wave will be waveHeight + waveThickness.

waveVelocity

the horizontal movement (speed per second and direction) of the whole wave (aka phase shift). Setting speed to 0.dp or less stops the movement.

waveThickness

the thickness of the active line (whether animated or not).

trackThickness

the thickness of the inactive line.

incremental

whether to gradually increase height from zero at start to waveHeight at thumb.

animationSpecs

animation configurations used for various properties of the wave.


fun WavySlider(value: Float, onValueChange: (Float) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, valueRange: ClosedFloatingPointRange<Float> = 0f..1f, onValueChangeFinished: () -> Unit? = null, colors: SliderColors = SliderDefaults.colors(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, waveLength: Dp = SliderDefaults.WaveLength, waveHeight: Dp = SliderDefaults.WaveHeight, waveVelocity: WaveVelocity = SliderDefaults.WaveVelocity, waveThickness: Dp = SliderDefaults.WaveThickness, trackThickness: Dp = SliderDefaults.TrackThickness, incremental: Boolean = SliderDefaults.Incremental, animationSpecs: WaveAnimationSpecs = SliderDefaults.WaveAnimationSpecs, thumb: @Composable (SliderState) -> Unit = { SliderDefaults.Thumb( interactionSource = interactionSource, colors = colors, enabled = enabled ) }, track: @Composable (SliderState) -> Unit = { sliderState -> SliderDefaults.Track( colors = colors, enabled = enabled, sliderState = sliderState, ///////////////// ///////////////// ///////////////// waveLength = waveLength, waveHeight = waveHeight, waveVelocity = waveVelocity, waveThickness = waveThickness, trackThickness = trackThickness, incremental = incremental, animationSpecs = animationSpecs ) })(source)

A wavy slider much like the Material Design 3 Slider.

Setting waveHeight or waveLength to 0.dp results in a regular Slider.

Note that range sliders do not make sense for the WavySlider. So, there is no RangeWavySlider counterpart.

Parameters

value

current value of the WavySlider. Will be coerced to valueRange.

onValueChange

callback in which value should be updated.

modifier

the Modifier to be applied to this WavySlider.

enabled

controls the enabled state of this WavySlider. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

valueRange

range of values that this WavySlider can take. The passed value will be coerced to this range.

onValueChangeFinished

called when value change has ended. This should not be used to update the WavySlider value (use onValueChange instead), but rather to know when the user has completed selecting a new value by ending a drag or a click.

colors

SliderColors that will be used to resolve the colors used for this WavySlider in different states. See SliderDefaults.colors.

interactionSource

the MutableInteractionSource representing the stream of Interactions for this WavySlider. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this slider in different states.

waveLength

the distance over which the wave's shape repeats.

waveHeight

the total height of the wave (from crest to trough i.e. amplitude * 2). The final rendered height of the wave will be waveHeight + waveThickness.

waveVelocity

the horizontal movement (speed per second and direction) of the whole wave (aka phase shift). Setting speed to 0.dp or less stops the movement.

waveThickness

the thickness of the active line (whether animated or not).

trackThickness

the thickness of the inactive line.

incremental

whether to gradually increase height from zero at start to waveHeight at thumb.

animationSpecs

animation configurations used for various properties of the wave.

thumb

the thumb to be displayed on the WavySlider, it is placed on top of the track. The lambda receives a SliderPositions which is used to obtain the current active track.

track

the track to be displayed on the WavySlider, it is placed underneath the thumb. The lambda receives a SliderPositions which is used to obtain the current active track.


fun WavySlider(state: SliderState, modifier: Modifier = Modifier, enabled: Boolean = true, colors: SliderColors = SliderDefaults.colors(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, waveLength: Dp = SliderDefaults.WaveLength, waveHeight: Dp = SliderDefaults.WaveHeight, waveVelocity: WaveVelocity = SliderDefaults.WaveVelocity, waveThickness: Dp = SliderDefaults.WaveThickness, trackThickness: Dp = SliderDefaults.TrackThickness, incremental: Boolean = SliderDefaults.Incremental, animationSpecs: WaveAnimationSpecs = SliderDefaults.WaveAnimationSpecs, thumb: @Composable (SliderState) -> Unit = { SliderDefaults.Thumb( interactionSource = interactionSource, colors = colors, enabled = enabled ) }, track: @Composable (SliderState) -> Unit = { sliderState -> SliderDefaults.Track( colors = colors, enabled = enabled, sliderState = sliderState, ///////////////// ///////////////// ///////////////// waveLength = waveLength, waveHeight = waveHeight, waveVelocity = waveVelocity, waveThickness = waveThickness, trackThickness = trackThickness, incremental = incremental, animationSpecs = animationSpecs ) })(source)

A wavy slider much like the Material Design 3 Slider.

Setting waveHeight or waveLength to 0.dp results in a regular Slider.

Note that range sliders do not make sense for the WavySlider. So, there is no RangeWavySlider counterpart.

Parameters

state

SliderState which contains the slider's current value.

modifier

the Modifier to be applied to this WavySlider.

enabled

controls the enabled state of this WavySlider. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

colors

SliderColors that will be used to resolve the colors used for this WavySlider in different states. See SliderDefaults.colors.

interactionSource

the MutableInteractionSource representing the stream of Interactions for this WavySlider. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this slider in different states.

waveLength

the distance over which the wave's shape repeats.

waveHeight

the total height of the wave (from crest to trough i.e. amplitude * 2). The final rendered height of the wave will be waveHeight + waveThickness.

waveVelocity

the horizontal movement (speed per second and direction) of the whole wave (aka phase shift). Setting speed to 0.dp or less stops the movement.

waveThickness

the thickness of the active line (whether animated or not).

trackThickness

the thickness of the inactive line.

incremental

whether to gradually increase height from zero at start to waveHeight at thumb.

animationSpecs

animation configurations used for various properties of the wave.

thumb

the thumb to be displayed on the WavySlider, it is placed on top of the track. The lambda receives a SliderPositions which is used to obtain the current active track.

track

the track to be displayed on the WavySlider, it is placed underneath the thumb. The lambda receives a SliderPositions which is used to obtain the current active track.